﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using Command;
using Entity;

namespace DAL
{
    public class T_Order
    {
        //查询所有省
        public static SqlDataReader Area()
        {
            string sql = string.Format("select * from Area where parentID = 0");
            return DBHelper.Getdata(sql);
        }

        //查询市
        public static SqlDataReader City(string i)
        {
            string sql = string.Format("select * from Area where parentID = '{0}'", i);
            return DBHelper.Getdata(sql);
        }

        //查询县
        public static SqlDataReader County(string i)
        {
            string sql = string.Format("select * from Area where parentID = '{0}'", i);
            return DBHelper.Getdata(sql);
        }

        //添加地址
        public static bool AddAddress(ShoppingAddress ads)
        {
            string sql = string.Format("insert ShoppingAddress values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", ads.UserID, ads.Saveid, ads.Cityid, ads.Countyid, ads.AddressValue, 1, ads.Name, ads.phone);
            return DBHelper.Adddata(sql) > 0;
        }
    }
}
